
#ifndef __HAL_MCU_H__
#define __HAL_MCU_H__
#include "stdint.h"
#include "CH58x_common.h"

// watch dog function -----------------------------------------------------------------------------------------------
extern void WdtClean(void);

// HAL GPIO functions -----------------------------------------------------------------------------------------------
extern void GPIOInit_Normal(void);
extern void GPIOInit_Sleep(void);

extern void FanSwitch(int isOn);
extern void CondenserFanSwitch(int isOn);
extern void MotoSwitch(int isOn);
extern void HeaterSwitch(int isOn);
extern void MeltSwitch(int isOn);
extern void LightSwitch(int isOn);

extern int GPIOReadDoorState(void);
extern int GPIOReadSystemSwitchState(void);
extern int GPIOReadHumanSensor(void);

extern int PowRead12vState(void);
extern int HalReadBatteryState(void);

extern void BuzzorAlarm(int isOn);

// time functions ------------------------------------------------------------------------------------
extern void RtcInit_1s(void);
extern void M0InitTimer(void);
extern void M0TimerClear(void);
// HAL Interrupt functions -----------------------------------------------------------------------------------------------



//外部中断axd_interrupt.c处定义的数据START
extern uint8_t Tx0Buff[256];
extern uint8_t Rx0Buff[1024];
extern volatile uint16_t Tx0Counter         ;
extern volatile uint16_t Rx0Counter         ;
extern volatile uint8_t u8Rx0Flag;           //接收完成标志位
extern volatile uint8_t u8Rx0OverTime;       //接收超时标志位
extern volatile uint8_t u8Tx0Flag;           //接收完成标志位
extern volatile uint8_t u8Tx0OverTime;       //接收超时标志位
extern volatile uint8_t u8Tx0SendNum;        //每次中断要发送的数据总个数
extern volatile uint8_t rtc_it_flag;
extern volatile uint32_t RTCTigFlag;

// power functions -----------------------------------------------------------------------------------------------
extern void McuSleep(void);
extern void BatteryInit(void);


extern short BatteryUpdateState(int span_s, short last_state);
extern int HalReadBatteryState(void);


//  测试辅助代码 -----------------------------------------------------------------------------------------------
extern int zy_test_cnt;
extern void TestBuzzor100ms(void);
extern void TestSpeechKata1(void);


#endif /* __HAL_MCU_H__ */
